package com.yanqu.road.server.manager.activity.feast.task;

import com.yanqu.road.logic.helper.ActivityHelper;
import com.yanqu.road.server.manager.activity.feast.CrossFeastMgr;
import com.yanqu.road.server.manager.activity.feast.activity.CrossFeastActivity;
import com.yanqu.road.utils.executor.GeneralTask;

import java.util.Map;

/**
 * 玩家碰撞定时器
 * 0.1s 1次
 */
public class FeastCheckUserCollisionTask extends GeneralTask {

    @Override
    public void doRun() {
        Map<Integer, CrossFeastActivity> activityMap = CrossFeastMgr.getActivityMap();
        if (activityMap == null || activityMap.isEmpty()) {
            // 无活动
            return;
        }
        for (CrossFeastActivity feastActivity : activityMap.values()) {
            try {
                if (!ActivityHelper.activityInTime(feastActivity.getConfig().getActivityInfo())) {
                    continue;
                }
                feastActivity.checkBulletCollisionTask();
            } catch (Exception e) {
                getLOGGER().error("checkUserCollisionTask error : ", e);
            }
        }
    }
}
